
#ifndef OGDL_I_SOCKET_H__
# define OGDL_I_SOCKET_H__

# include <string>
# include <ogdl/network/Net.h>

namespace ogdl
{
    class ISocket
    {
    public:
        virtual void socket(net::SockDomain, net::SockType) = 0;
        virtual void bind(std::string const &, int) = 0;
        virtual void listen(int) = 0;

        virtual void accept(ISocket *) = 0; // TCP server-side only !
        virtual void connect(std::string const &, int) = 0; // TCP client-size only !

        /*
    protected:
        virtual int recv(void *, size_t, int) = 0; // TCP
        virtual int recvfrom(void *, size_t, int,) = 0; // UDP

        virtual int send(void *, size_t, int) = 0; // TCP
        virtual int sendto(void *, size_t, int) = 0; // UDP
        */
    public:
        virtual void close() = 0;

        virtual void read(void *, size_t, int) = 0;
        virtual void write(void *, size_t, int) = 0;

        virtual std::string const & lastError() const = 0;
    };

}

#endif  // OGDL_I_SOCKET_H__
